home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.20010921-20020314
/
000136_spcecdt@deeptht.armory.com_Fri Nov 9 09:29:30 EST 2001.msg
< prev
next >
Wrap
Text File
|
2020-01-01
|
2KB
|
50 lines
Article: 12955 of comp.protocols.kermit.misc
Path: newsmaster.cc.columbia.edu!panix!howland.erols.net!news.maxwell.syr.edu!news-out.visi.com!hermes.visi.com!gemini.tycho.net.POSTED!not-for-mail
Newsgroups: comp.unix.sco.misc,comp.protocols.kermit.misc
Subject: Re: OSR5 <sys/termio.h> (OSR5 modem signals)
References: <9s775v$ip0$1@newsmaster.cc.columbia.edu> <9sc7ku$81i$1@newsmaster.cc.columbia.edu> <3bea05eb$0$79559$8eec23a@newsreader.tycho.net> <9se63k$kqo$1@newsmaster.cc.columbia.edu>
Organization: The Armory
X-Newsreader: trn 4.0-test69 (20 September 1998)
From: spcecdt@deeptht.armory.com (John DuBois)
Date: 09 Nov 2001 02:35:22 GMT
Lines: 33
Message-ID: <3beb40ea$0$79556$8eec23a@newsreader.tycho.net>
NNTP-Posting-Host: 4e8892dd.newsreader.tycho.net
X-Trace: 1005273322 gemini.tycho.net 79556 spcecdt@192.122.209.42
X-Complaints-To: abuse@tycho.net
Xref: newsmaster.cc.columbia.edu comp.unix.sco.misc:140065 comp.protocols.kermit.misc:12955
In article <9se63k$kqo$1@newsmaster.cc.columbia.edu>,
Frank da Cruz <fdc@watsun.cc.columbia.edu> wrote:
> ttyfd = open(name,O_RDWR|O_NONBLOCK);
> tcsetattr(ttyfd,TCSADRAIN,&ttcur);
>
>... any write() to the reopened device gets error 11, "Resource
>temporarily unavailable". Did I miss a step? Or is this a difference
>between 5.0.6a and earlier OSR5s?
You missed a step (the same one that a lot of app writers did); it's one that
didn't trip anyone up until tty behaviour was made POSIX-correct in 5.0.0.
POSIX requires that O_NONBLOCK make tty io non-blocking, which is rarely what
you want - O_NONBLOCK is almost always used just to allow opening of a
modem-control line without DCD being asserted. After opening the device, you
need to turn off non-blocking mode with something like:
tcsetattr CLOCAL, else the following will disable IO until DCD is
asserted.
if ((flags = fcntl (ttyfd, F_GETFL)) == -1)
error...
flags &= ~O_NONBLOCK;
if (fcntl (ttyfd, F_SETFL, flags) == -1)
error...
I don't know why you didn't encounter this in earlier 5.0, and you also should
not encounter it until you've written enough data to fill up the tty output
buffer (that's when non-blocking mode causes writes to start failing with errno
11). But in any case, my guess is that adding the above will resolve your
problem.
John
--
John DuBois spcecdt@armory.com. KC6QKZ/AE http://www.armory.com./~spcecdt/